showFacturas=function(){
    var path="facturas.php";
    new TableOrderer("facturas",{
        url:path,
        callBack:selectFactura,
        filter:'top'
    });
}
var factSelecionada;
selectFactura=function(f){
    factSelecionada=f;
    URL="view.php?id="+f.ID;
    reporte = window.open(URL,'_blank', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=550,height=500,left = 0,top = 0');
}

addOnLoad(function(){ 
    showFacturas();
});

doChange=function(value){
    $("value").value=value;
    waitMsg("Cambiando Estado");
    new Ajax.Request("data.php",{
        parameters:$(document.factura).serialize(),
        onComplete:function(r){
            closeWait();
            alert(r.responseText);
            $(document.factura).submit();
        }
    });
}